const Service = require('egg').Service

class UserInfoService extends Service {
    /* 添加个人信息 */
    /* 什么操作之前都需要查询一边 */
    async find() {

        let id = this.ctx.session.uid.ID

        const user = await this.ctx.model.Users.findById(id)

        return user
    }

    async update(query, getUser) {
        const update = await getUser.update({
            userName: query.userName,
            profile: query.profile,
            avatar: query.url
        })

        return update
    }
}

module.exports = UserInfoService